import 'package:ceramics/util/ab_value_converter.dart';

extension StringExtension on String {
  String fileName() {
    return split('/').last;
  }
}


extension OSSResponseExtension on String {
  bool isExpired() {
    RegExp exp = RegExp(r"Expires=(\d+)");
    var match = exp.firstMatch(this);
    if (match != null) {
      var expires = match.group(1);
      var now = DateTime.now().millisecondsSinceEpoch ~/ 1000;
      return valueToInt(expires) < now;
    }
    return false;
  }
}